/* 田忌赛马 */

#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;

int main(void)
{
	constexpr int N = 3;
	int qiwang[N] = {95, 87, 74};
	int tianji[N] = {92, 83, 71};

	sort(qiwang, qiwang + N, greater<int>{});

	int leftQiwang = 0, leftTianji = 0;
	int rightQiwang = N - 1, rightTianji = N - 1;

	for (int i = 0; i < N; i++)
	{
		if (tianji[leftTianji] > qiwang[leftQiwang])
		{
			/* 田忌最快的马比齐王最快的马快，则比两个最快的马 */
			cout<< tianji[leftTianji] << " <--> " << qiwang[leftQiwang] << "\n";
			leftTianji++;
			leftQiwang++;

		}
		else if (tianji[leftTianji] < qiwang[leftQiwang])
		{
			/* 田忌最快的马比齐王最快的马慢，则用田忌最慢的马去比齐王最快的马 */
			cout<< tianji[rightTianji] << " <--> " << qiwang[leftQiwang] << "\n";
			rightTianji--;
			leftQiwang++;
		}
		else	/* 两人最快的马一样快 */
		{
			if (tianji[rightTianji] > qiwang[rightQiwang])
			{
				/* 田忌最慢的马比齐王最慢的马快，则比较两个最慢的马 */
				cout<< tianji[rightTianji] << " <--> " <<qiwang[rightQiwang] << "\n";
				rightTianji--;
				rightQiwang--;
			}
			else
			{
				/* 用田忌最慢的马去比齐王最快的马 */
				cout<< tianji[rightTianji] << " <--> " << qiwang[leftQiwang] << "\n";
				rightTianji--;
				leftQiwang++;
			}
		}
	}
}
